package com.hengxinguotong.hxgtwygsp.ui.supervisePhone;

import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;

import com.hengxinguotong.hxgtwygsp.R;
import com.hengxinguotong.hxgtwygsp.model.SupervisePhoneBean;
import com.hengxinguotong.hxgtwygsp.ui.base.BaseDialogActivity;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by CS-Yong
 * 2019/8/8  17:10
 */
public class SupervisePhoneActivity extends BaseDialogActivity implements SupervisePhoneContract.IView{
    @Inject
    SupervisePhoneContract.IPresenter mPresenter;

    @BindView(R.id.member_close)
    ImageView mMemberClose;
    @BindView(R.id.rv_phone)
    RecyclerView mRvPhone;

    private SupervisePhoneAdapter mAdapter;
    private List<SupervisePhoneBean> mBeanList = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPresenter.bindView(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresenter.dropView();
    }


    @Override
    public int getLayoutResId() {
        return R.layout.activity_supervise_phone;
    }

    @Override
    public void init() {
        mockData();
        mAdapter = new SupervisePhoneAdapter(R.layout.item_supervise_phone,mBeanList);
        GridLayoutManager layoutManager = new GridLayoutManager(this, 3, LinearLayoutManager.VERTICAL, false);
        mRvPhone.setLayoutManager(layoutManager);
        mRvPhone.setAdapter(mAdapter);
    }

    private void mockData() {
        mBeanList.add(new SupervisePhoneBean("江汉区房管局投诉受理","027-85795888"));
        mBeanList.add(new SupervisePhoneBean("江汉区市场监督管理局","027-65693652"));
        mBeanList.add(new SupervisePhoneBean("江汉区建设局","027-85732417"));
        mBeanList.add(new SupervisePhoneBean("江汉区常青派出所","83529456"));
        mBeanList.add(new SupervisePhoneBean("武汉市自然资源和规划局江汉分局","027-85767006"));
        mBeanList.add(new SupervisePhoneBean("武汉市生态环境保护局江汉分局","027-65662630"));
        mBeanList.add(new SupervisePhoneBean("武汉市江汉区城市管理委员会","027-65650905"));
        mBeanList.add(new SupervisePhoneBean("武汉市天然气有限公司","96511"));
        mBeanList.add(new SupervisePhoneBean("武汉市水务集团有限公司","96510"));
        mBeanList.add(new SupervisePhoneBean("国家电网-武汉供电公司","95598"));
    }


    @OnClick(R.id.member_close)
    public void onViewClicked() {
        finish();
    }
}
